import sqlite3  
  
# 连接到数据库文件  
conn = sqlite3.connect('example.db')  
  
# 创建一个游标对象  
cursor = conn.cursor()  
  
# 执行 SQL 语句  
cursor.execute('CREATE TABLE IF NOT EXISTS example_table (id INTEGER PRIMARY KEY, name TEXT)')  
  
# 插入数据  
cursor.execute('INSERT INTO example_table (name) VALUES (?)', ('Alice',))  
cursor.execute('INSERT INTO example_table (name) VALUES (?)', ('Bob',))  
  
# 提交更改  
conn.commit()  
  
# 查询数据  
cursor.execute('SELECT * FROM example_table')  
rows = cursor.fetchall()  
for row in rows:  
    print(row)  
  
# 关闭连接  
conn.close()